package windbell.domain.risk.events;

import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import windbell.domain.risk.RiskCheck;
import windbell.domain.risk.RiskCheckSource;
import windbell.domain.risk.events.RiskCheckSourceEventsListener;

@Service("windbell.domain.risk.events.RiskCheckSourceEventsManager")
public class RiskCheckSourceEventsManager extends EntityEventsManager<RiskCheckSource> {
  @Autowired(required = false)
  private Collection<RiskCheckSourceEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<RiskCheckSourceEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireCreateRiskCheck(final RiskCheckSource entity, final Procedure1<? super RiskCheck> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckSourceEventsListener)listener).createRiskCheck(entity,init);
    }
    
  }
  
  public void fireDelete(final RiskCheckSource entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckSourceEventsListener)listener).delete(entity);
    }
    
  }
}
